<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .echart{
            width: 500px;
            height: 500px;
        }
    </style>
</head>
<body>
折线图
<div class="echart allNumEchart"  id="allNumEchart"></div>
<script src="../jquery.min.js" charset="utf-8"></script>
<script src="../echarts.js"></script>
<script>
  //初始化echarts
  var myChartApplications;
  init();
  function init(){
    allNumEchart();//折线图
  };
  //折线图
  function allNumEchart() {
    /*逐年专利申请量-echart*/
    if (myChartApplications != null && myChartApplications != "" && myChartApplications != undefined) {
      myChartApplications.dispose();
    }
    var echartNameDataArr = []; //X轴名称
    var echartNumDataArr = []; //Y轴数量
    //列出标准列表-获得标准名字及专利数量
    // ajaxYearByDeclEntityList().then(function (yearList) {
    // console.log('tc', tcList);
    // for (var i = 0; i < tcList.length; i++) {
    var i = 0;
    // repeat();
    function repeat() {
      if (i < yearList.length) {
        if (yearList[i] <= sendData.staticAnalysisEnd.split('-')[0] && yearList[i] >= sendData.staticAnalysisStart.split('-')[0]) {
          ajaxCountByDeclEntity(yearList[i]).then(function (StandardNum) {
            // if (StandardList[i][2] != null && StandardList[i][2] != "" && StandardList[i][2] != undefined) {
            //   echartNameDataArr.push(StandardList[i][2].split('-')[0]); //截取年份字符串
            // } else {
            //   echartNameDataArr.push(StandardList[i][2]); //截取年份字符串
            // }
            echartNameDataArr.push(yearList[i]); //截取年份字符串
            echartNumDataArr.push(StandardNum);
            i++;
            repeat();
          });
        } else {
          i++;
          repeat();
        }
      } else {
        console.log('Standard', echartNameDataArr, echartNumDataArr);
        echartSetOption(); //构建标准分布 echarts
      }
    }
    echartSetOption();
    //构建标准分布 echarts
    function echartSetOption() {
      // 基于准备好的dom，初始化echarts实例
      myChartApplications = echarts.init(document.getElementById('allNumEchart'));
      // 指定图表的配置项和数据
      var option = {
        color: ['#3398DB', '#91c7ae'],
        title: {
          // text: '逐年专利申请量'
        },
        tooltip: {
          trigger: 'axis',
          // axisPointer: {
          //   type: 'shadow'
          // }
        },
        legend: {},
        dataZoom: {},
        grid: {
          left: '5%',
          top: '15%',
          right: '5%',
          bottom: '5%',
          containLabel: true
        },
        xAxis: {
          data: ["1970", "1975", "1980", "1985", "1990", "1995"]
          // data: echartNameDataArr
        },
        yAxis: {},
        series: [{
          name: '专利数量',
          type: 'line',
          barMaxWidth: '30px',
          data: [15, 30, 46, 80, 110, 150]
          // data: echartNumDataArr
        }]
      };
      // 使用刚指定的配置项和数据显示图表。
      myChartApplications.setOption(option);
    };
    // });
  };
</script>
</body>
</html>